package com.wd.live.view;

/**
 * <p>项目名称:LookFor2_0</p>
 * <p>包名:com.wd.live.view.costom</p>
 * <p>简述:ViewPage滑动冲突</p>
 *
 * @author 孟令高
 * @date 2022/11/11
 */
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;
public class MyViewPage extends ViewPager {
    public MyViewPage(@NonNull Context context) {
        super(context);
    }

    public MyViewPage(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {

        if (getChildCount()>1){
            getParent().requestDisallowInterceptTouchEvent(true);
        }

        return super.onInterceptTouchEvent(ev);
    }
}
